<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>SMART VE</title>
<link rel="stylesheet" href="resources/css/jquery.mobile-1.3.0.css" />
<link rel="stylesheet" href="resources/css/main.css" />
<script type="text/javascript" src="resources/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="resources/js/jquery.mobile-1.3.0.min.js"></script>
<script type="text/javascript">
$(function(){
	getList();
});

function getList(){
	var url="project.do";
	var action="getProjectList";
	$('.board_list li').remove();
	
	$.getJSON(url, "action="+action, function(json){
		if(json.length>0){
			var li=[];
			
			for(var i=0; i<json.length; i++){
				li[i]  = '<li data-filtertext="'+json[i].PROJECT_NAME+'"><a href="#" onclick="project_detail(\''+json[i].IDX+'\');">';
				li[i] += '<p class="title">'+json[i].PROJECT_NAME+'</p>';
				li[i] += '<div>';
				li[i] += '	<span class="name">'+json[i].USERNAME+'</span> |';
				li[i] += '	<span class="type">'+json[i].PROJECT_TYPE+'</span> |';
				li[i] += '	<span class="date">'+json[i].PROJECT_REG_DATE+'('+setZeros(json[i].DAY_CNT, 2)+'일차)</span>';

				li[i] += '<input type="hidden" name="project_create_username" id="project_create_username" value="'+json[i].PROJECT_CREATE_USERNAME+'">';
			
				li[i] += '</div>';
				li[i] += '</a></li>';
				
			}
			$('.board_list li').remove();
			$('.board_list').append(li.join(''));
		}
		else{
			$('.board_list li').remove();
			
		}
		
	});
	
	
}
function newProject(){
	location.href="project.do?action=newProject";
}
function projectKey(){
	location.href="project.do?action=projectKey";
}

</script>
</head>

<body>
<div id="wrapper" class="main" data-role="page">
	<div id="header_srch" data-role="header" data-position="fixed" data-tap-toggle="false">		
		<a href="javascript:projectKey();" class="btn_left">key</a>
		<h1>진행 프로젝트 목록</h1>
		<a href="javascript:newProject();" class="btn_right">new</a>
<!-- 2013-05-27 div class="search" 삭제 -->
	</div>
<!-- 2013-05-27 수정 -->
	<div id="container_none" data-role="content" class="pnl_content">
		<div id="project_list">
			<ul data-role="listview" data-filter="true" data-filter-placeholder="Search Project name" data-inset="true" class="board_list">
				
			</ul>
		</div>
<!-- 2013-05-27 수정 끝 -->
	</div>
	<div id="footer" data-position="fixed" data-tap-toggle="false" data-role="footer">
		<ul class="nav clfix">
			
			<!-- 활성화된 메뉴에 class="active" 붙이고 해당 img 이미지 off -> on 으로 변경 -->
			
			<li><a href="#" class="active"><img src="resources/images/nav1_on.png" alt="진행목록" /></a></li>
			<li><a href="#"><img src="resources/images/nav2_off.png" alt="완료목록" /></a></li>
			<li><a href="#"><img src="resources/images/nav3_off.png" alt="설정" /></a></li>
		</ul>
	</div>
</div>
</body>
<script type="text/javascript" src="resources/js/common.js"></script>
</html>